package com.ikas.ai.server.module.assessment.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ikas.ai.server.module.assessment.dao.AssessWfResultMapper;
import com.ikas.ai.server.module.assessment.model.po.AssessWfResult;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 工况模型评价结果表 服务实现类
 * </p>
 *
 * @author wuyf
 * @since 2023-10-31
 */
@Service
public class AssessWfResultService extends ServiceImpl<AssessWfResultMapper, AssessWfResult>{

    /**
     * 通过流程实例id获取评价结果值
     * @param modelId 模型id
     * @param flowInstanceId 流程实例id
     * @return AssessWfResult
     */
    public AssessWfResult getAwfResultByFlowInstanceId(Long modelId, Long flowInstanceId) {
        LambdaQueryWrapper<AssessWfResult> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AssessWfResult::getModelId, modelId);
        queryWrapper.eq(AssessWfResult::getFlowInstanceId, flowInstanceId);
        return this.getOne(queryWrapper);
    }

}
